<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Document</title>
</head>

<body>
  <div id="app">
    <fa-cpn></fa-cpn>
  </div>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

  <template id="fa-cpn">
      <div>
        <h3>我是父组件的标题</h3>
        <p>我是父组件的内容</p>
        <p>数据：{{message}}</p>
        <son-cpn></son-cpn>
      </div>
    </template>

  <script type="text/x-template" id="son-cpn">
    <div>
      <h3>我是子部组件的标题</h3>
      <p>我是子组件的内容</p>
    </div>
  </script>

  <script>
    Vue.component("faCpn", {
      template: `#fa-cpn`,
      components: {
        sonCpn: {
          template: `#son-cpn`,
        },
      },
      data() {
        return {
          message: "我是父组件的数据",
        };
      },
    });

    const app = new Vue({
      el: "#app",
      data: {
        message: "hello",
      },
    });
  </script>
</body>

</html>